//------奖金测算 数据 人员考核结果--//------
import request from "@/router/axios";


export function fetchList(query) {
  return request({
    url: '/bonus/bonuspersonpenalty/page',
    method: 'get',
    params: query
  })
}

//新增
export function addObj(obj) {
  return request({
    url: '/bonus/bonuspersonpenalty',
    method: 'post',
    data: obj
  })
}

//编辑
export function putObj(obj) {
  return request({
    url: '/bonus/bonuspersonpenalty',
    method: 'put',
    data: obj
  })
}


export function delBatch(ids) {
  return request({
    url: '/bonus/bonuspersonpenalty/deleteBatch',
    method: 'get',
    params: ids
  })
}

export function getPeriodDic() {
  return request({
    url: '/bonus/bonuspersonpenalty/getRqList',
    method: 'get',
  })
}

//通过周期获取奖惩数据
export function getDataByPeriod(period,type) {
  let url = ''
  if (type == 'ry'){
    url = '/bonus/bonuspersonpenalty/getPersonOtherDataList/' ;
  }else{
    url = '/bonus/bonusdeptpenalty/getDeptOtherDataList/' ;
  }
  return request({
    url: url +period,
    method: 'get',
  })
}


export function saveAssementList(obj,type) {
  let url  = '' ;
  if (type == 'ry'){
    url = '/bonus/bonuspersonpenalty/bath' ;
  }else{
    url = '/bonus/bonusdeptpenalty/bath' ;
  }
  return request({
    url: url, //换接口
    method: 'post',
    data: obj
  })
}

//获取奖金系数
export function getRatioList(obj) {
  return request({
    url: '/bonus/bonusitem/getjjxBydept',
    method: 'get',
  })
}

//保存系数
export function saveRatioList(obj) {
  return request({
    url: '/bonus/bonusitem/savejcData',
    method: 'post',
    data: obj
  })
}

//同步依据库
export function asyncYjk(deptId,type) {
  return request({
    url: 	`/bonus/bonusratio/addRatioByDeptId/${deptId}/${type}`,
    method: 'get',
  })
}

//获取奖金系数
export function getYjkList(deptId,yjkfl) {
  return request({
    url: `/bonus/bonusratio/getRatioByDeptId/${deptId}/${yjkfl}`,
    method: 'get',
  })
}

//保存依据库每条对应的系数
export function saveYjkRatioList(obj) {
  return request({
    url: '/bonus/bonusratio/batch',
    method: 'post',
    data: obj
  })
}
